﻿<phone:PhoneApplicationPage x:Class="AuchanScan.Views.PromosPage"
                            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                            xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
                            xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
                            xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
                            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                            xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" mc:Ignorable="d"
                            d:DesignWidth="480" d:DesignHeight="728" FontFamily="{StaticResource PhoneFontFamilyNormal}"
                            FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}"
                            SupportedOrientations="Portrait" Orientation="Portrait"
                            xmlns:Bewise_Phone="clr-namespace:Bewise.Phone;assembly=Bewise.Phone"
                            DataContext="{Binding Path=PromoViewModel,Source={StaticResource ViewModelLocator}}"
                            toolkit:TiltEffect.IsTiltEnabled="True">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="White">
        <!--Pivot Control-->
        <Image Source="../images/Page_Background2.png" Stretch="Fill" Grid.RowSpan="2" />
        <!--Pivot Control-->
        <controls:Pivot Title="" Margin="0,50,0,0" Foreground="Black">
            <controls:PivotItem Header="catalogues">
                <ListBox ItemsSource="{Binding PromotionService.Promotions.Tracts}" HorizontalContentAlignment="Stretch">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Grid Margin="0,0,0,12">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="0.5*" />
                                    <RowDefinition Height="0.5*" />
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <Image Source="{Binding Image}" MaxWidth="130" d:LayoutOverrides="Width, Height" Grid.RowSpan="2" />
                                <TextBlock Style="{StaticResource PhoneTextLargeStyle}" Text="{Binding Name}" d:LayoutOverrides="Width"
                           Grid.Column="1" TextWrapping="Wrap" VerticalAlignment="Bottom" />
                                <StackPanel Grid.Column="1" VerticalAlignment="Top" Margin="12,0,0,0" Grid.Row="1">
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Style="{StaticResource PhoneTextAccentStyle}" Text="valable du" Margin="0,0,6,0"
                               Foreground="{StaticResource AccentBrushPromo}" d:LayoutOverrides="Height" />
                                        <TextBlock Style="{StaticResource PhoneTextAccentStyle}" Text="{Binding StartDate, StringFormat=dd/MM/yy}"
                               d:LayoutOverrides="Height" Margin="0,0,6,0" Foreground="{StaticResource AccentBrushPromo}" />
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Style="{StaticResource PhoneTextAccentStyle}" Text="au" Margin="0,0,6,0"
                               Foreground="{StaticResource AccentBrushPromo}" d:LayoutOverrides="Height" />
                                        <TextBlock Style="{StaticResource PhoneTextAccentStyle}" Text="{Binding EndDate, StringFormat=dd/MM/yy}"
                               d:LayoutOverrides="Height" Margin="0,0,6,0" Foreground="{StaticResource AccentBrushPromo}" />
                                    </StackPanel>
                                </StackPanel>
                            </Grid>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </controls:PivotItem>
            <controls:PivotItem Header="rayon">
                <!--ListBox ItemTemplate="{StaticResource rTemplate}" ItemsSource="{Binding rCollection}" DataContext="{Binding}"/-->
                <Bewise_Phone:JumpList ItemsSource="{Binding PromotionService.Promotions.Rayons}" ShowHeaders="True">
                    <Bewise_Phone:JumpList.ItemTemplate>
                        <DataTemplate>
                            <Grid>
                                <TextBlock TextWrapping="Wrap" Text="{Binding Name}" Style="{StaticResource PhoneTextLargeStyle}"
                           d:LayoutOverrides="Width, Height" Margin="12" />
                            </Grid>
                        </DataTemplate>
                    </Bewise_Phone:JumpList.ItemTemplate>
                </Bewise_Phone:JumpList>
            </controls:PivotItem>
            <controls:PivotItem Header="toutes">
                <ListBox Margin="12,0,12,0" ItemsSource="{Binding PromotionService.Promotions.OffresPartielles}" HorizontalContentAlignment="Stretch" ItemContainerStyle="{StaticResource StretchListBoxItemStyle}">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Grid Margin="0,0,0,12">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <Image Source="{Binding Image1}" MaxHeight="90" />
                                <TextBlock Style="{StaticResource PhoneTextTitle3Style}" Text="{Binding Nom1}" VerticalAlignment="Center"
                           d:LayoutOverrides="Width, Height" Grid.Column="1" FontWeight="Bold" TextWrapping="Wrap" />
                                <StackPanel Grid.Column="2" Margin="12,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Right">
                                    <TextBlock TextWrapping="Wrap" Text="{Binding Price, StringFormat='{0}€'}" Style="{StaticResource PhoneTextLargeStyle}" Margin="0"
          					Foreground="#FFFF8601" d:LayoutOverrides="Width" HorizontalAlignment="Right" />
                                    <TextBlock Text="au lieu de" Style="{StaticResource PhoneTextNormalStyle}"
          					Margin="0" d:LayoutOverrides="Width" Foreground="Black" />
                                    <Border Margin="0"
          					d:LayoutOverrides="Width" Background="#FFF1F1F1" >
                                        <Grid Height="36" Width="87">
                                            <TextBlock TextWrapping="Wrap" Text="{Binding StrikePrice, StringFormat='{0}€'}" Style="{StaticResource PhoneTextLargeStyle}" FontSize="26.667" Foreground="Black" Margin="0" HorizontalAlignment="Center" />
                                            <Path Data="M79,8 L0,28" Stretch="Fill" UseLayoutRounding="False" StrokeThickness="2" Stroke="#7F000000"/>
                                        </Grid>
                                    </Border>
                                </StackPanel>
                            </Grid>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </controls:PivotItem>
        </controls:Pivot>
        <Grid Margin="12,12,12,0" VerticalAlignment="Top">
            <Image Source="../images/Logo.png" HorizontalAlignment="Left" Height="66.5550003051758" MaxHeight="50"
             Margin="12,0,0,0" />
        </Grid>
        <Image Height="64" Source="/images/herbe.png" Stretch="Fill" VerticalAlignment="Bottom" Margin="0,0,0,8" />
        <Rectangle Height="8" VerticalAlignment="Bottom" Fill="{StaticResource AccentBrushPromo}" />
    </Grid>

    <!--Sample code showing usage of ApplicationBar-->
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton x:Name="appbar_button1" IconUri="/icons/appbar.favs.rest.png"
                                      Text="favoris" />
            <shell:ApplicationBarIconButton x:Name="appbar_button2" IconUri="/icons/appbar.send.text.rest.png"
                                      Text="partager" />
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

</phone:PhoneApplicationPage>
